| Conditions | 3 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | class Queue1 { |
||
| 36 | dequeue() { |
||
| 37 | let result; |
||
| 38 | // - Pop out all elements from Stack1, push to Stack2 |
||
| 39 | while (this.stack1.top()) { |
||
| 40 | this.stack2.push(this.stack1.pop()); |
||
| 41 | } |
||
| 42 | // - Pop from Stack2 |
||
| 43 | result = this.stack2.pop(); |
||
| 44 | // - Pop out all remaining elements from Stack2, push back to Stack1 |
||
| 45 | while (this.stack2.top()) { |
||
| 46 | this.stack1.push(this.stack2.pop()); |
||
| 47 | } |
||
| 48 | return result; |
||
| 49 | } |
||
| 50 | peek() { |
||
| 59 |